#include <stdio.h>

int flag = 0;

int check_word(char ch);
char change_cap(char ch);

int main() {
    char ch;
    int first_word = 0;
    int in_separator = 1;
    while ((ch = getchar()) != '\n' && ch != EOF) {
        if (check_word(ch)) {
            if (!flag) {
                ch = change_cap(ch);
                flag = 1;
                if (first_word && in_separator) {
                    printf("\n");
                }
                printf("%c", ch);
                first_word = 1;
                in_separator = 0;
            } else {
                printf("%c", ch);
            }
        } else {
            flag = 0;
            in_separator = 1;
        }
    }
    return 0;
}

int check_word(char ch) {
    if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
        return 1;
    } else {
        return 0;
    }
}

char change_cap(char ch) {
    if (ch >= 'a' && ch <= 'z') {
        return ch - 32;
    }
    return ch;
}    
